import request from '@/utils/request'

// 查询优惠券列表
export function listCouponManage(query) {
  return request({
    url: '/marketingManagement/couponManage/list',
    method: 'get',
    params: query
  })
}

// 查询优惠券详细
export function getCouponManage(couponId) {
  return request({
    url: '/marketingManagement/couponManage/' + couponId,
    method: 'get'
  })
}

// 新增优惠券
export function addCouponManage(data) {
  return request({
    url: '/marketingManagement/couponManage',
    method: 'post',
    data: data
  })
}
export function insertcouponMember(data) {
  return request({
    url: '/marketingManagement/couponManage/insertcouponMember',
    method: 'post',
    data: data
  })
}

// 修改优惠券
export function updateCouponManage(data) {
  return request({
    url: '/marketingManagement/couponManage',
    method: 'put',
    data: data
  })
}
// 启停用
export function stopUsingEnabled(data) {
  return request({
    url: '/marketingManagement/couponManage/stopUsingEnabled',
    method: 'put',
    data: data
  })
}
// 删除优惠券
export function delCouponManage(couponId) {
  return request({
    url: '/marketingManagement/couponManage/' + couponId,
    method: 'delete'
  })
}

// 导出优惠券
export function exportCouponManage(query) {
  return request({
    url: '/marketingManagement/couponManage/export',
    method: 'get',
    params: query
  })
}
//下载图片
export function downloadImgs(params) {
  return request({
    url: '/common/download/url',//后端自定义的下载接口/common/download/url，路径为admin模块的com.ruoyi.web.controller.common;
    responseType: 'blob', //设置后端返回类型为二进制流，不设置会返回乱码
    method: 'get',
    params
  })
}
